import java
from javax.xml.xpath import *
import org.xml.sax.InputSource as InputSource
import CacheMan


def tableGraph( A ):
	pass
	# take attribute list and make a table graph


def AttributeList():
	doc = "kegg.xml"
	expression = '/pathway/*';
	inputSource =  InputSource("kegg.xml"); 
	print expression
	xpath = XPathFactory.newInstance().newXPath();
	nl = xpath.evaluate(expression,inputSource,XPathConstants.NODESET)
	N=[]
	l=[]
	for x in xrange(0,nl.getLength()):
		node= nl.item(x)
		l=[]
		for y in xrange(0,node.attributes.getLength()):
			l +=[node.attributes.item(y)]
		N += [l]
	print N

	# once we get attributes, figure out what we can make into a graph..
	# give the user a prompt box to chose the attributes that define a node
	# and the attribute that links two nodes (e.g. reaction)
	#.
	#
	#
	#
	#


AttributeList()